//
//  FZQLoginPromptViewController.m
//  BiliBiliDemo
//
//  Created by IMAC on 16/4/20.
//  Copyright © 2016年 XDH. All rights reserved.
//

#import "FZQLoginPromptViewController.h"

static CGFloat const imageW = 300;

@implementation FZQLoginPromptViewController


#pragma mark - life cycle
-(void)viewDidLoad
{
    [super viewDidLoad];
    
    //设置背景颜色
    self.view.backgroundColor = RGBCOLOR(247, 247, 247);
    
    /** 设置图片控件 */
    [self setupImageView];
    
    /** 设置按钮 */
    [self setupBtn];
}

#pragma mark - setup 
/** 设置图片控件 */
-(void)setupImageView
{   
    //创建imageView
    UIImageView *imageView = [[UIImageView alloc]initWithImage:[UIImage FileImageWithContentsOfFileName:@"login_forbidden"]];
    
    //设置位置与尺寸
    imageView.center = CGPointMake(SCREEN_WIDTH * 0.5, SCREEN_HEIGHT * 0.3);
    imageView.bounds = CGRectMake(0, 0, imageW, imageW);
    
    //添加到视图中
    [self.view addSubview:imageView];

}

/** 设置按钮 */
-(void)setupBtn
{   
    //生成按钮
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    
    //设置文字属性
    [btn setTitle:@"登录" forState:UIControlStateNormal];
    [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [btn setTitleColor:[UIColor grayColor] forState:UIControlStateHighlighted];
    
    //设置常规背景图片属性
    [btn setBackgroundColor:RGBCOLOR(241, 158, 194)];
    
    //设置按钮位置及尺寸
    btn.center = CGPointMake(SCREEN_WIDTH * 0.5, SCREEN_HEIGHT * 0.55);
    btn.bounds = CGRectMake(0, 0, 150, 35);
    
    //设置按钮layer层
    btn.layer.cornerRadius = 5;
    btn.layer.borderWidth = 2;
    btn.layer.borderColor = RGBCOLOR(241, 158, 194).CGColor;
  
    //为按钮增加方法
    [btn addTarget:self action:@selector(modalToLogin) forControlEvents:UIControlEventTouchDown];
    
    //加入控件中
    [self.view addSubview:btn];
}

#pragma mark - Methods
/* 跳转登录页面 */
- (void)modalToLogin
{
    //获取登录单例
//    UIViewController *login = [ ];
    
    //modal到登录页面
//    [self presentViewController:login animated:YES completion:nil];
    [self dismissViewControllerAnimated:YES completion:nil];
}

@end
